package org.trackcore.controller;

import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import org.trackcore.common.BaseResponse;
import org.trackcore.common.ResultUtils;
import org.trackcore.model.entity.PerformanceLCP;
import org.trackcore.service.PerformanceLCPService;

@RestController
@RequestMapping("/performance/lcp")
@Api(tags = "性能LCP接口")
public class PerformanceLCPController {
    @Autowired
    private PerformanceLCPService lcpService;

    @GetMapping("/list")
    @ApiOperation("分页查询所有LCP")
    public BaseResponse<IPage<PerformanceLCP>> list(
            @RequestParam(defaultValue = "1") Integer pageNum,
            @RequestParam(defaultValue = "10") Integer pageSize) {
        return ResultUtils.success(
                lcpService.page(new Page<>(pageNum, pageSize))
        );
    }
}
